<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
</head>
<body>
<div id="app">
    <input type="text" v-model="search">
    <hr>
    <ul>
        <li v-for="item in finallyPerson" :key="item.id">name:{{item.name}}---age:{{item.age}}</li>
    </ul>
</div>
<script>
    Vue.config.productionTip = false
    const vm = new Vue({
        el: '#app',
        data() {
            return {
                search:'',
                persons:[
                    {id:'001',name:'周杰伦',age:18},
                    {id:'002',name:'陈冠希',age:8},
                    {id:'003',name:'华晨宇',age:28},
                    {id:'004',name:'张杰',age:30},
                    {id:'005',name:'张靓颖',age:23},
                    {id:'006',name:'周深',age:51}
                ],
                finallyPerson:[]
            }
        },
        watch:{
            search:{
                immediate:true,
                handler(){
                    this.finallyPerson = this.persons.filter(item=>item.name.includes(this.search))
                }
            }
        }
    })
</script>
</body>
</html>